import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_svg/svg.dart';
import 'package:seedfour/toolkit/typedef/function.dart';

import '../../../../constants.dart';
import '../../../../theme.dart';

class MineGroup extends StatelessWidget {
  final ParamVoidCallback onClickTeam;

  final ParamVoidCallback onClickInvite;

  const MineGroup({
    Key? key,
    required this.onClickTeam,
    required this.onClickInvite,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Ink(
      width: double.maxFinite,
      decoration: const BoxDecoration(
        color: Colors.white,
      ),
      child: Column(
        children: [
          _buildItem('assets/icons/ic_mine_invite.svg', '邀请', onClickInvite),
          _buildItem('assets/icons/ic_mine_group.svg', '分身', onClickTeam),
        ],
      ),
    );
  }

  Widget _buildItem(String icon, String title, ParamVoidCallback onClick) {
    return InkWell(
      onTap: () => onClick(),
      child: Padding(
        padding: EdgeInsets.symmetric(
            vertical: kSpaceSmall, horizontal: kSpaceMedium),
        child: Row(
          children: [
            SvgPicture.asset(
              icon,
              width: kIconSizeMini,
              height: kIconSizeMini,
            ),
            SizedBox(width: kSpaceTiny),
            Expanded(
              child: Text(
                title,
                style: TextStyle(
                  color: AppColor.colorFontBlack,
                  fontSize: kFontSizeSmall,
                  fontWeight: AppFont.fontRegular,
                ),
              ),
            ),
            Icon(
              Icons.arrow_forward_ios,
              color: AppColor.colorFontGrey,
              size: 13.w,
            ),
          ],
        ),
      ),
    );
  }
}
